/*******************************************************************************


*******************************************************************************/
#ifndef CUSTOM_BOARD_H
#define CUSTOM_BOARD_H

#ifdef __cplusplus
extern "C" {
#endif

#define   BLE_EN                      1
#define   DFU_EN                      1
#define   WDT_EN                      1
#define   TEST_LOG_EN                 0



#if defined(PASS_V1_1) || defined(PASS_V1_2)

#define HW_VER                    "PASS V1.3"
#define DEV_MODEL                 "PASS"
#define DEVICE_HW_MAJOR_REV       2
#define DEVICE_HW_MINOR_REV       3
#define DEV_NAME                  "PASS"
#define DEV_TYPE_FULL             "PASS"

//power
#define   POWER_EN3V3_PIN         14
#define   POWER_EN3V5_PIN         22
#define   POWER_ENBAT_PIN         27

//HC595
#define HC595_RCLK1_PIN           24
#define HC595_RCLK2_PIN           18

#define NRFX_SPI2_MISO_PIN        15
#define NRFX_SPI2_MOSI_PIN        2
#define NRFX_SPI2_SCK_PIN         3

#define NRFX_SPI1_MISO_PIN        12
#define NRFX_SPI1_MOSI_PIN        13
#define NRFX_SPI1_SCK_PIN         11

#define NRFX_TWI0_SCL_PIN         29
#define NRFX_TWI0_SDA_PIN         28

#define NRFX_SX1278_DIO0_PIN      6
#define NRFX_SX1278_DIO3_PIN      7

//#define   LED1_PIN




//LCD
#define   HT1621_LCD_SPI_SS_PIN       9
#define   HT1621_LCD_SPI_MOSI_PIN     2
#define   HT1621_LCD_SPI_SCK_PIN      3



//ADC CO
#define SENSOR_ADC_P            NRF_SAADC_INPUT_AIN2
#define SENSOR_ADC_N            NRF_SAADC_INPUT_AIN3


//#define



//BUTTONS
#define BUTTONS_NUMBER 3
#define BUTTON_START   31
#define BUTTON_1       31
#define BUTTON_2       8
#define BUTTON_3       21
#define BUTTON_STOP    31
#define BUTTON_PULL    NRF_GPIO_PIN_PULLUP
#define BUTTONS_ACTIVE_STATE 1
#define BUTTONS_LIST {BUTTON_1, BUTTON_2, BUTTON_3}
#define BSP_BUTTON_0   BUTTON_1
#define BSP_BUTTON_1   BUTTON_2
#define BSP_BUTTON_2   BUTTON_3


#define RX_PIN_NUMBER                 NRF_GPIO_PIN_MAP(0,12)
#define TX_PIN_NUMBER                 NRF_GPIO_PIN_MAP(0,19)
#define UART_TX_BUF_SIZE              256                                         /**< UART TX buffer size. */
#define UART_RX_BUF_SIZE              256                                         /**< UART RX buffer size. */


#endif          /* PASS_V1_1 */



#if defined PASS_V1_3

#define HW_VER                    "PASS V1.3"
#define DEV_MODEL                 "PASS"
#define DEVICE_HW_MAJOR_REV       1
#define DEVICE_HW_MINOR_REV       3
#define DEV_NAME                  "PASS"
#define DEV_TYPE_FULL             "PASS"

//power
#define   POWER_EN3V3_PIN         12
#define   POWER_ENBAT_PIN         16
#define   POWER_EN5V_PIN          24
#define   CHG_DET_PIN             14

//HC595
#define HC595_RCLK1_PIN           11

#define NRFX_SPI2_MISO_PIN        2
#define NRFX_SPI2_MOSI_PIN        8
#define NRFX_SPI2_SCK_PIN         7

#define NRFX_SPI1_MISO_PIN        5
#define NRFX_SPI1_MOSI_PIN        4
#define NRFX_SPI1_SCK_PIN         6

#define NRFX_SX1278_NSS_PIN       25
#define NRFX_FLASH_NSS_PIN        3

#define NRFX_TWI0_SCL_PIN         20
#define NRFX_TWI0_SDA_PIN         19

#define NRFX_SX1278_DIO0_PIN      26
#define NRFX_SX1278_DIO3_PIN      27



//LCD
#define   HT1621_LCD_SPI_SS_PIN       22
#define   HT1621_LCD_SPI_MOSI_PIN     8
#define   HT1621_LCD_SPI_SCK_PIN      7

//ADC CO
#define SENSOR_ADC_P            NRF_SAADC_INPUT_AIN6
#define SENSOR_ADC_N            NRF_SAADC_INPUT_AIN7


//BUTTONS
#define BUTTONS_NUMBER 3
#define BUTTON_START   31
#define BUTTON_1       21
#define BUTTON_2       13
#define BUTTON_3       23
#define BUTTON_STOP    31
#define BUTTON_PULL    NRF_GPIO_PIN_PULLUP
#define BUTTONS_ACTIVE_STATE 1
#define BUTTONS_LIST {BUTTON_1, BUTTON_2, BUTTON_3}
#define BSP_BUTTON_0   BUTTON_1
#define BSP_BUTTON_1   BUTTON_2
#define BSP_BUTTON_2   BUTTON_3


#define RX_PIN_NUMBER                 NRF_GPIO_PIN_MAP(0,29)
#define TX_PIN_NUMBER                 NRF_GPIO_PIN_MAP(0,28)
#define UART_TX_BUF_SIZE              256                                         /**< UART TX buffer size. */
#define UART_RX_BUF_SIZE              512                                         /**< UART RX buffer size. */

#define UARTE0_RX_PIN                 29
#define UARTE0_TX_PIN                 28

#endif    //PASS_V1_3

#if defined PASS_V1_4

#define HW_VER                    "PASS V1.4"
#define DEV_MODEL                 "PASS"
#define DEVICE_HW_MAJOR_REV       1
#define DEVICE_HW_MINOR_REV       4
#define DEV_NAME                  "PASS"
#define DEV_TYPE_FULL             "PASS"

//power
#define   POWER_EN3V3_PIN         8
#define   POWER_ENBAT_PIN         16
#define   POWER_EN5V_PIN          24
#define   CHG_DET_PIN             12

//HC595
#define HC595_RCLK1_PIN           7

#define NRFX_SPI2_MISO_PIN        18
#define NRFX_SPI2_MOSI_PIN        6
#define NRFX_SPI2_SCK_PIN         3

#define NRFX_SPI1_MISO_PIN        31
#define NRFX_SPI1_MOSI_PIN        30
#define NRFX_SPI1_SCK_PIN         2

#define NRFX_SX1278_NSS_PIN       29
#define NRFX_FLASH_NSS_PIN        19

#define NRFX_TWI0_SCL_PIN         13
#define NRFX_TWI0_SDA_PIN         14

#define NRFX_SX1278_DIO0_PIN      28
#define NRFX_SX1278_DIO3_PIN      27



//LCD
#define   HT1621_LCD_SPI_SS_PIN       22
#define   HT1621_LCD_SPI_MOSI_PIN     6
#define   HT1621_LCD_SPI_SCK_PIN      3

//ADC CO
#define SENSOR_ADC_P            NRF_SAADC_INPUT_AIN3
#define SENSOR_ADC_N            NRF_SAADC_INPUT_AIN2


//BUTTONS
#define BUTTONS_NUMBER 3
#define BUTTON_START   31
#define BUTTON_1       21
#define BUTTON_2       11
#define BUTTON_3       23
#define BUTTON_STOP    31
#define BUTTON_PULL    NRF_GPIO_PIN_PULLUP
#define BUTTONS_ACTIVE_STATE 1
#define BUTTONS_LIST {BUTTON_1, BUTTON_2, BUTTON_3}
#define BSP_BUTTON_0   BUTTON_1
#define BSP_BUTTON_1   BUTTON_2
#define BSP_BUTTON_2   BUTTON_3


#define RX_PIN_NUMBER                 NRF_GPIO_PIN_MAP(0,25)
#define TX_PIN_NUMBER                 NRF_GPIO_PIN_MAP(0,26)
#define UART_TX_BUF_SIZE              256                                         /**< UART TX buffer size. */
#define UART_RX_BUF_SIZE              512                                         /**< UART RX buffer size. */

#define UARTE0_RX_PIN                 25
#define UARTE0_TX_PIN                 26

#define BEEP_PIN    15

#endif    //PASS_V1_4



#if defined PASS_V1_5

#define HW_VER                    "PASS V1.5"
#define DEV_MODEL                 "PASS"
#define DEVICE_HW_MAJOR_REV       1
#define DEVICE_HW_MINOR_REV       5
#define DEV_NAME                  "PASS"
#define DEV_TYPE_FULL             "PASS"

//power
#define   POWER_EN3V3_PIN         30
#define   POWER_ENBAT_PIN         17
#define   POWER_EN5V_PIN          24
#define   CHG_DET_PIN             18

//HC595
#define HC595_RCLK1_PIN           3

#define NRFX_SPI2_MISO_PIN        25
#define NRFX_SPI2_MOSI_PIN        7
#define NRFX_SPI2_SCK_PIN         6

#define NRFX_SPI1_MISO_PIN        12
#define NRFX_SPI1_MOSI_PIN        13
#define NRFX_SPI1_SCK_PIN         11

#define NRFX_SX1278_NSS_PIN       14
#define NRFX_FLASH_NSS_PIN        26

#define NRFX_TWI0_SCL_PIN         22
#define NRFX_TWI0_SDA_PIN         23

#define NRFX_SX1278_DIO0_PIN      15
#define NRFX_SX1278_DIO3_PIN      16



//LCD
#define   HT1621_LCD_SPI_SS_PIN       24
#define   HT1621_LCD_SPI_MOSI_PIN     7
#define   HT1621_LCD_SPI_SCK_PIN      6

//ADC CO
#define SENSOR_ADC_P            NRF_SAADC_INPUT_AIN3
#define SENSOR_ADC_N            NRF_SAADC_INPUT_AIN2


//BUTTONS
#define BUTTONS_NUMBER 3
#define BUTTON_START   31
#define BUTTON_1       21
#define BUTTON_2       8
#define BUTTON_3       2
#define BUTTON_STOP    31
#define BUTTON_PULL    NRF_GPIO_PIN_PULLUP
#define BUTTONS_ACTIVE_STATE 1
#define BUTTONS_LIST {BUTTON_1, BUTTON_2, BUTTON_3}
#define BSP_BUTTON_0   BUTTON_1
#define BSP_BUTTON_1   BUTTON_2
#define BSP_BUTTON_2   BUTTON_3


#define RX_PIN_NUMBER                 NRF_GPIO_PIN_MAP(0,28)
#define TX_PIN_NUMBER                 NRF_GPIO_PIN_MAP(0,29)
#define UART_TX_BUF_SIZE              256                                         /**< UART TX buffer size. */
#define UART_RX_BUF_SIZE              512                                         /**< UART RX buffer size. */

#define UARTE0_RX_PIN                 28
#define UARTE0_TX_PIN                 29

#define BEEP_PIN    20


#endif      /* PASS_V1_5 */



#if defined (S212)
// Low frequency clock source to be used by the SoftDevice
#define NRF_CLOCK_LFCLKSRC      {.source        = NRF_CLOCK_LF_SRC_XTAL,            \
                                 .rc_ctiv       = 0,                                \
                                 .rc_temp_ctiv  = 0,                                \
                                 .xtal_accuracy = NRF_CLOCK_LF_XTAL_ACCURACY_20_PPM}
#else

#define NRF_CLOCK_LFCLKSRC      {.source       = NRF_CLOCK_LF_SRC_XTAL,      \
                                 .rc_ctiv      = 0,                          \
                                 .rc_temp_ctiv = 0,                          \
                                 .accuracy     = NRF_CLOCK_LF_ACCURACY_20_PPM}
#endif

#ifdef __cplusplus
}
#endif


#endif /* CUSTOM_BOARD_H */
